import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

// 按需导入 路由
const Home = () => import('Pages/home')
const Error = () => import('Pages/error')
const Member = () => import('Pages/member')
const Login = () => import('Pages/member/Login')
const Product = () => import('Pages/product')

const routes = [{
    path: '/',
    redirect: '/:storeId/pages/home/index/:wid'
}, {
    path: '*',
    component: Error
}, {
    path: '/:storeId/pages/home/index/:wid',
    component: Home,
    name: 'Home',
    meta: {isShow: false}    // 路由元信息
}, {
    path: '/:storeId/pages/error/index/:code',
    component: Error,
    name: 'Error'
}, {
    path: '/:storeId/pages/member/index/:wid',
    component: Member,
    name: 'Member'
}, {
    path: '/:storeId/pages/login/index/:wid',
    component: Login,
    name: 'Login'
}, {
    path: '/:storeId/pages/product/index/:id',
    component: Product,
    name: 'Product'
}]

export default new VueRouter({
    base: process.env.BASE_URL,
    routes
})